package com.lbs.dao.Impl;

import com.lbs.dao.CourseUserDao;
import com.lbs.entity.CourseUser;
import com.lbs.utils.BaseDao;

import java.util.List;

/**
 * @author Administrator
 * @date 2021/6/2 10:26
 * @description
 **/
public class CourseUserDaoImpl extends BaseDao<CourseUser> implements CourseUserDao {
    /**
     * 分页查询选课信息
     * @param sql
     * @param params
     * @return
     */
    @Override
    public List<CourseUser> findCourseUserByName(String sql, Object... params) {
        return findMore(sql,CourseUser.class,params);
    }

    /**
     * 修改选课信息
     * @param id
     * @param cid
     * @return
     */
    @Override
    public int updateCourseUserById(int cid, int id) {
        String sql = "update course_user set cid = ? where id = ?";
        return update(sql,cid,id);
    }

    /**
     * 批量删除课程信息
     * @param id
     * @return
     */
    @Override
    public int deleteCourseById(String id) {
        String sql = "delete from course_user where id = ?";
        return update(sql,id);
    }
}
